<template>
    <div class="container">
        <page-table :func="func" ref="pt"
        >
            <template slot="img" slot-scope="data">
                <image-preview :src="data.data.row.img"></image-preview>
            </template>
			<template v-slot:moreoperation="{data}">
				<el-button type="warning" size="small" v-if="data.row.isDefault==0" @click="changeDefault(data.row.id)">设为默认</el-button>
				<!-- <div>
					{{ data.row.isDefault }}
				</div> -->
			</template>
        </page-table>

    </div>
</template>
<script>
import pageTable from "@/components/page-table.vue"
import ImagePreview from "@/components/image-preview.vue"
import func from "./index.js"
import {setDefault} from "@/apis/qrcode/index"
export default {
	name:"qrcode",
	components:{
		pageTable,
		ImagePreview
	},
	data(){
		return {
			func
		}
	},
	methods:{
		changeDefault(id){
			setDefault(id).then(()=>{
				this.$refs.pt.getList()
			})
		}
	}
}
</script>